package com.iflytek.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.iflytek.dao.UserDao;
import com.iflytek.domain.User;
import com.iflytek.service.UserService;
import com.iflytek.utils.MD5Utils;

@Service
public class UserServiceImpl implements UserService {

	@Autowired
	private UserDao ud;

	@Override
	public Boolean findUserIsRegistSuccess(User user) {
		int row=ud.insertUserByUser(user);
		return row>0?true:false;
	}

	@Override
	public Boolean findPhoneNumberIsRegisted(String userphone) {
		int row=ud.findPhoneByPhoneNumber(userphone);
		return row>0?true:false;
	}

	@Override
	public Boolean findUserIsVerification(String phone, String password) {
		String Md5Password=MD5Utils.md5(password);
		int row=ud.findUserIsVerification(phone,Md5Password);
		return row>0?true:false;
	}

	@Override
	public User getUserByPhoneNumber(String phone) {
		return ud.getUserByPhoneNumber(phone);
	}

}
